﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace VideoCache.Server.ViewModel
{
    public class UserModel
    {
        public int Id { get; set; }
        [Required]
        [Display(Name = "用户名")]
        [Remote("IsUserNameExists", "User", "Admin", ErrorMessage = "用户名已经存在！", HttpMethod = "POST")]
        public string UserName { get; set; }
        [Required]
        [Display(Name = "密码")]
        public string Password { get; set; }
        [Required]
        [Display(Name = "电子邮件")]
        [RegularExpression(@"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", ErrorMessage = "请输入正确的邮箱格式")]
        [Remote("IsEmailExists", "User", "Admin", ErrorMessage = "电子邮件已经存在！", HttpMethod = "POST")]
        public string Email { get; set; }
        [Required]
        [Display(Name = "手机号码")]
        public string MobilePhone { get; set; }
    }
}